<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Wuye/zuge')}">房屋列表</a></li>
        <li class="active"><a href="{:url('Wuye/zugeAdd')}">修改信息</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Wuye/zugeSave')}">


        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>小区名称:</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="xiaoqu" value="{$res.xiaoqu|default=''}">
            </div>
        </div>

        <script type="text/javascript">
            $(document).ready(function(){
                $.ajax({
                    type: "POST",
                    url: "{:url('portal/mei/san')}",
                    data: {},
                    dataType:"json",
                    success: function(res){
                        var html = '';
                        var data = res['data'];
                        if(data != ''){
                            $.each(data,function(index,value){
                                html += '<option value="'+data[index]['provinceID']+'">'+data[index]['province']+'</option>';
                            });
                            $("#province").append(html);
                        }
                    }
                });

                $("#province").change(function(){
                    var provinceID = $("#province option:selected").val();
                    $.ajax({
                        type: "POST",
                        url: "{:url('portal/mei/san')}",
                        data: {provinceID:provinceID},
                        dataType:"json",
                        success: function(res){
                            console.log(res);
                            var html = '';
                            $("#city").html('');
                            var data = res['data'];
                            if(data != ''){
                                $.each(data,function(index,value){
                                    html += '<option value="'+data[index]['cityID']+'">'+data[index]['city']+'</option>';
                                });
                                $("#city").append(html);
                            }
                        }
                    });
                });

                $("#city").change(function(){
                    var cityID = $("#city option:selected").val();
                    console.log(cityID);
                    $.ajax({
                        type: "POST",
                        url: "{:url('portal/mei/san')}",
                        data: {cityID:cityID},
                        dataType:"json",
                        success: function(res){
                            console.log(res);
                            var html = '';
                            $("#area").html('');
                            var data = res['data'];
                            if(data != ''){
                                $.each(data,function(index,value){
                                    html += '<option value="'+data[index]['areaID']+'">'+data[index]['area']+'</option>';
                                });
                                $("#area").append(html);
                            }
                        }
                    });
                });
            });
        </script>
        <div class="form-group row">
            <label class="col-sm-2 control-label">所属区域</label>
            <div class="col-sm-2">
                <select name="province" id="province" class="form-control">
                    <option value="{$res.provinceID|default=''}">{$res.Pname|default=''}</option>
                </select>
            </div>
            <div class="col-sm-2">
                <select name="city" id="city" class="form-control">
                    <option value="{$res.cityID|default=''}">{$res.Cname|default=''}</option>
                </select>
            </div>
            <div class="col-sm-2">
                <select name="area" id="area" class="form-control">
                    <option value="{$res.areaID|default=''}">{$res.Aname|default=''}</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>面积:</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="fangwumianji" value="{$res.fangwumianji|default=''}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>标题:</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="biaoti" value="{$res.biaoti|default=''}">
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 control-label">厅室</label>
            <div class="col-sm-2">
                <select name="tingshi" class="form-control">
                    <volist name="can" id="tingshi">
                        <if condition="$tingshi.cate_id eq 1">
                            <option value="{$tingshi.id|default=''}"  <if condition="$tingshi.cate_id eq $res.tingshi">selected</if> >{$tingshi.name|default=''}</option>
                        </if>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 control-label">朝向</label>
            <div class="col-sm-2">
                <select name="chaoxiang" class="form-control">
                    <volist name="can" id="chaoxiang">
                        <if condition="$chaoxiang.cate_id eq 2">
                            <option value="{$chaoxiang.id|default=''}"  <if condition="$chaoxiang.cate_id eq $res.tingshi">selected</if> >{$chaoxiang.name|default=''}</option>
                        </if>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 control-label">楼层</label>
            <div class="col-sm-2">
                <select name="louceng" class="form-control">
                    <volist name="can" id="louceng">
                        <if condition="$louceng.cate_id eq 3">
                            <option value="{$louceng.id|default=''}"  <if condition="$louceng.cate_id eq $res.tingshi">selected</if> >{$louceng.name|default=''}</option>
                        </if>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 control-label">类型</label>
            <div class="col-sm-2">
                <select name="leixing" class="form-control">
                    <volist name="can" id="leixing">
                        <if condition="$leixing.cate_id eq 4">
                            <option value="{$leixing.id|default=''}"  <if condition="$leixing.cate_id eq $res.tingshi">selected</if> >{$leixing.name|default=''}</option>
                        </if>
                    </volist>
                </select>
            </div>
        </div>

        <if condition="$res.type eq 'chushou'">
            <div class="form-group row">
                <label class="col-sm-2 control-label">产权年限</label>
                <div class="col-sm-2">
                    <select name="chanquannianxian" class="form-control">
                        <volist name="can" id="cqnianxian">
                            <if condition="$cqnianxian.cate_id eq 5">
                                <option value="{$cqnianxian.id|default=''}"  <if condition="$cqnianxian.cate_id eq $res.tingshi">selected</if> >{$cqnianxian.name|default=''}</option>
                            </if>
                        </volist>
                    </select>
                </div>
            </div>
        </if>

        <if condition="$res.type eq 'chushou'">
            <div class="form-group row">
                <label class="col-sm-2 control-label">产权类型</label>
                <div class="col-sm-2">
                    <select name="chanquanleixing" class="form-control">
                        <volist name="can" id="cqleixing">
                            <if condition="$cqleixing.cate_id eq 6">
                                <option value="{$cqleixing.id|default=''}"  <if condition="$cqleixing.cate_id eq $res.tingshi">selected</if> >{$cqleixing.name|default=''}</option>
                            </if>
                        </volist>
                    </select>
                </div>
            </div>
        </if>

        <div class="form-group row">
            <label class="col-sm-2 control-label">装修</label>
            <div class="col-sm-2">
                <select name="zhuangxiu" class="form-control">
                    <volist name="can" id="zhuangxiu">
                        <if condition="$zhuangxiu.cate_id eq 7">
                            <option value="{$zhuangxiu.id|default=''}"  <if condition="$zhuangxiu.cate_id eq $res.tingshi">selected</if> >{$zhuangxiu.name|default=''}</option>
                        </if>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>房屋详情:</label>
            <div class="col-md-6 col-sm-10">
                <!--<input type="text" class="form-control" name="fangwuxiangqing" value="{$res.fangwuxiangqing|default=''}">-->
                <textarea name="fangwuxiangqing" class="form-control">"{$res.fangwuxiangqing|default=''}</textarea>
            </div>
        </div>

        <input type="hidden" name="id" value="{$id|default=''}">
        <input type="hidden" name="type" value="{$res.type|default=''}">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary js-ajax-submit" value="">保存</button>
        </div>
    </form>

</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>